package com.heima.controller;

import com.heima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;


@Slf4j
@RestController
@RequestMapping("/api/order-service/report")
public class ReportController {

    @Autowired
    private ReportService reportService;

    @GetMapping("/orderCount")
    public Long orderCount(String start,String end){
        log.info("当月订单总量：{}，{}",start,end);
        return reportService.orderCount(start,end);
    }

    @GetMapping("/orderAmount")
    public BigDecimal orderAmount(String start, String end){
        log.info("当月销售额：{}，{}",start,end);
        return reportService.orderAmount(start,end);
    }

}
